#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "common.h"

int GenerateRandomData(int *random, int len, int max)
{
	int i = 0;

	if (random == NULL || len == 0 || max <= 0)
	{
		return PARAMETER_ERROR;
	}

	srand((unsigned int)time(NULL));

	while (i < len)
	{
		random[i] = rand();
		if (random[i] <= max)
		{
			i++;
		}
	}
	return 0;
}